﻿<!DOCTYPE html>
<html>
<head>
    <title>搜索</title>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <script src="/js/jquery/jquery.min.js"></script>
    <meta name="full-screen" content="yes">
    <meta name="browsermode" content="application">
    <meta name="x5-fullscreen" content="true">
    <meta name="x5-page-mode" content="app">
    <link rel="stylesheet" type="text/css" href="css/base.css"/>
    <link rel="stylesheet" type="text/css" href="css/x_index.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script>
        $(function () {
            var tickets;
            var scenic;
            $("#search").click(function () {
                var keyword = $("#cityqwz").val();
                console.log(keyword);
                if (keyword) {
                    $(".hot").html("");
                    $.get("/scenics", {keyword: keyword,history:1}, function (data) {
                        if (data.list.length == 0){
                            $(document).dialog({
                                type: 'notice',
                                infoText: '搜索内容为空!',
                                autoClose: 2500,
                                position: 'center'  // center: 居中; bottom: 底部
                            });
                        }
                        console.log(data);
                        $.each(data.list, function (index, ele) {
                            console.log(ele.id);
                            console.log(ele.coverUrl);
                            console.log(ele.name);
                            scenic = $("#seek .mb").clone(true);
                            scenic.find("a").attr('href', '/piao.html?id=' + ele.id);
                            scenic.find("img").attr('src', ele.coverUrl);
                            scenic.find("h1").html(ele.name);
                            $(".hot").append(scenic);
                        });
                    })
                }
            })
            $.get("/scenics/history",function (data) {
                var history;
                $.each(data,function (index,ele) {
                    history += '<li><a class="search" data-href="/scenics" data-value="'+ele.name+'">'+ele.name+'</a></li>';
                })
                $("#ulId").append(history);
                $(".search").click(function () {
                    $("#ulId").html("");
                    var url = $(this).data('href');
                    var value = $(this).data('value');
                    $("#cityqwz").val(value);
                    $.get(url, {keyword: value}, function (data) {
                        if (data.list.length == 0){
                            $(document).dialog({
                                type: 'notice',
                                infoText: '搜索内容为空!',
                                autoClose: 2500,
                                position: 'center'  // center: 居中; bottom: 底部
                            });
                        }
                        $.each(data.list, function (index, ele) {
                            console.log(ele.id);
                            console.log(ele.coverUrl);
                            console.log(ele.name);
                            scenic = $("#seek .mb").clone(true);
                            scenic.find("a").attr('href', '/piao.html?id=' + ele.id);
                            scenic.find("img").attr('src', ele.coverUrl);
                            scenic.find("h1").html(ele.name);
                            $(".hot").append(scenic);
                        });
                    })
                })
            })
        })
    </script>
</head>
<link rel="stylesheet" type="text/css" href="css/search_m.css">
<body>



<div class="col-2 comment-head " id="seek" style="display: none">
    <div class="col-6 mb">
    <a >
        <img class="rounded-circle" style="width: 355px;height: 250px">
    </a>
        <div style="font-size: 25px;color: #1a5d7e">
            <h1></h1>
            <span>------------------------------------------</span>
        </div>
    </div>
</div>
<div id="search_page_1">
    <header class="header" style="position: relative;">
            <a class="fl" href="/scenic.html"><i class="b_1"></i></a>

        </header>
    <div class="search_index_content">
        <div class="search_index_content_head">
            <ul>
                <li><i class="jdmp"></i> 景点门票</li>
            </ul>
        </div>
        <div class="search_index_content_menu">
            <div class="search_item" style="display:blcok; margin-bottom:60px;">
                <div class="search_item_s clearfix">
                    <div class="search_item_s_b">
                        <form action="" id="form_xltj_search">
                            <div class="search_item_s_l">
								<span class="f_b_a_city">
                                <i class="city_i"></i>
                                <span style="display:none;"></span>

                                <input type="hidden" name="m" value="search">
                                <input type="hidden" id="city_en" name="city_en" value="beijing">
                                <input type="text" id="cityqwz" name="q" class="f_b_a_text" placeholder="搜索景点关键词"/>
                            </div>
                            <a id="search" class="r_a js_a" href="javascript:;"><i></i></a>
                        </form>
                    </div>
                </div>
                <div class="search_item_x hot">
                    <div class="item_x_t">
                        热门搜索词
                    </div>
                    <div class="item_x_m">
                        <ul id="ulId">
                            <!--<li><a data-href="/scenics?keyword=">碧水</a></li>-->
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<!--
<script src="js/zepto-byothers.min.js"></script>
<script src="js/search_index.js"></script>-->
<html>